from django.shortcuts import render
from rest_framework.generics import ListAPIView
from home.models import NavModel,BannerModel
from fuguang06.utils import constants
from home.searial import NavSerializer,BanerSerializer
from fuguang06.utils.views import CacheListApiView
# from rest_framework import status
# Create your views here.

# 导航的视图
# 顶部导航
# class NavHeardListViews(ListAPIView):
#     queryset = NavModel.objects.filter(is_delete=False,is_show=True,position=constants.NAV_HEARD).order_by('-id')[:constants.NAV_HEARD_SIZE]
#     serializer_class = NavSerializer
#
# class NavFooterListViews(ListAPIView):
#     queryset = NavModel.objects.filter(is_delete=False, is_show=True, position=constants.NAV_FOOTER).order_by('-id')[:constants.NVA_FOOTER_SIZE]
#     serializer_class = NavSerializer
#
#
# # 轮播图视图
# class BannerListApiView(ListAPIView):
#     queryset = BannerModel.objects.filter(is_show=True,is_delete=False).order_by('-id')[:constants.BANNER_SIZE]
#     serializer_class = BanerSerializer

class NavHeardListViews(CacheListApiView):
    queryset = NavModel.objects.filter(is_delete=False, is_show=True, position=constants.NAV_HEARD).order_by('-id')[:constants.NAV_HEARD_SIZE]
    serializer_class = NavSerializer

class NavFooterListViews(CacheListApiView):
    queryset = NavModel.objects.filter(is_delete=False, is_show=True, position=constants.NAV_FOOTER).order_by('-id')[:constants.NVA_FOOTER_SIZE]
    serializer_class = NavSerializer

    # 轮播图视图

class BannerListApiView(CacheListApiView):
    queryset = BannerModel.objects.filter(is_show=True, is_delete=False).order_by('-id')[:constants.BANNER_SIZE]
    serializer_class = BanerSerializer






# def login(request):
#     if request.method == "post":
#         return Response({'token':""})

# lookup_field = 'pk'
# lookup_url_kwarg = None

# lookup_field = 'pk'
# lookup_url_kwarg = None

# 底部导航














